<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo ($title); ?></title>


<script type="text/javascript" src="../Public/js/jq.js"></script>
<script>
$().ready(function(){
	$(':checkbox').attr('checked','');
	$('#selectall').change(function() {
		if ($('#selectall').attr('checked') == true) {
			$('.ctl').attr('checked', 'checked');
		} else {
			$('.ctl').attr('checked', '');
		}
	})
	
	
})
function add()
{
	if($('.addname').val()=='')
		{
		alert('请输入专业名称');
		$('.addname').focus();
		}else
		{
			name = $('.addname').val();
			pid = $('#parent').val();
			$.post('__URL__/savespeciality/',{
				'title':name,
				'pid':pid
			},function()
			{
				window.location.reload();
			})
		}
}
function del() {
	arr = null;
	$('.ctl').each(function() {
		if ($(this).attr('checked') == true) {
			if (arr == null)
				arr = $(this).val();
			else
				arr += ',' + $(this).val();
		}
	})
	if (arr == null) {
		alert('未选择任何数据');
	} else {
		$.post('__URL__/deletespeciality/',{
			'id':arr
		},function(data){
			window.location.reload();
		})
	}

}
</script>
</head>
<body>

<?php if(isset($sepcialitytable)): ?><table border="1">
<tr><td>&nbsp;</td><td>专业名称</td></tr>
<?php echo ($sepcialitytable); ?>
</table>
<p>全选:<input type="checkbox" id="selectall" /> 选中项：<input
	type="button" onclick="del()" value="删除" /></p><?php endif; ?>




<div class="addspeciality">

专业名称：<input type="text" class="addname" name="addname" />
所属栏目:<select id="parent"><option value="0">一级栏目</option>
<?php echo ($specialityselect); ?>
</select>
<input type="button" onclick="add()" value="添加" />


</div>
</body>
</html>